package com.itheima.stargraph.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

/**
 * TODO
 *
 * @Author mr.Candy
 * @Date 2025/6/816:12
 */
@Slf4j
@Component
public class ComfyuiMessageHandler extends TextWebSocketHandler {
    /**
     * 客户端建立连接后调用
     */
    @Override
    public void afterConnectionEstablished(WebSocketSession session) throws Exception {
        log.info("星图AI作为Client与ComfyUI连接成功");

    }
    /**
     * 收到comfyui消息后调用
     *
     * @param session
     * @param message
     * @throws Exception
     */
    @Override
    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
        log.info("收到ComfyUI消息：{}", message.getPayload());
    }
}
